
{% load i18n %}
<html>
	<head>
		<link rel="stylesheet" type="text/css" href="/media/css/flexigrid.pack.css" />
		<script src="/media/jslib/jquery.js"></script>
		<style>
		.grid_search {
			border:solid #CCC;border-width:0px 1px 1px 1px;
			background:url(/media/images/images_bg_grid.gif) 0px -877px repeat-x; 
			position:relative;
			margin:10px; 
			padding-bottom:8px;
		}	
		.Link_blue1 a:link , .Link_blue1 a:visited{color:#32598a; text-decoration:underline !important; cursor:pointer;}
		
		.Link_blue1 a:hover{color:#ff6600; text-decoration:none !important; cursor:pointer;}
		
		.tbl_form_search td{padding:8px 8px 8px 8px;word-break:keep-all;word-wrap:normal;white-space:nowrap;}
		</style>
			{% block custom_css %}
			{% endblock %}  
		
		<link href="/media/dwz/themes/default/style.css" rel="stylesheet" type="text/css" />
		<link href="/media/dwz/themes/css/core.css" rel="stylesheet" type="text/css" />
		<script src="/media/dwz/js/dwz.core.js" type="text/javascript"></script>
		<script src="/media/dwz/js/dwz.util.date.js" type="text/javascript"></script>
		<script src="/media/dwz/js/dwz.tree.js" type="text/javascript"></script>
		<script src="/media/dwz/js/dwz.ui.js" type="text/javascript"></script>
		<script src="/media/dwz/js/dwz.datepicker.js" type="text/javascript"></script>
		<script src="/media/dwz/js/dwz.regional.zh.js" type="text/javascript"></script>
		
		<script type="text/javascript">
		$(function(){
			DWZ.init("/media/dwz/dwz.frag.xml", {
				loginUrl:"login_dialog.html", loginTitle:"登录",	// 弹出登录对话框
				debug:false,	// 调试模式 【true|false】
				callback:function(){
					initEnv();
				}
			});
		});
		</script>
	</head>
<body style=" background:white;">
{% block content %}
				{% if search_form %}
				<!-- search_form start -->
                <div id="id_search" class="grid_search">
                    <div style="padding:5px; font-size:11;text-align:left;">{% trans "查询" %}</div>
                    <table style="width:99%;">
                    <tr>
                        <td>
                            <div>
							        <table width="100%" class="tbl_form_search" id="id_form_search">
							           {% autoescape off %}
							           {% for field in search_form %}
							               {% if forloop.first %}<tr class="header_div_left"> {% endif%}
							                    <td style="text-align:right;">{{ field|field_as_label_tag_no_asterisk }}</td> <td>{{ field.as_widget }}</td>
							               {% if forloop.counter|divisibleby:"3" %}
							                   </tr>
							                   <tr class="header_div_left">
							               {% endif %}
							               {% if forloop.last %}  </tr> {% endif %}
							           {% endfor %}    
							           {% endautoescape %}
							               </td></tr>    
							       </table>
                            </div> 
                        </td>
					</tr>
					<tr>
                        <td valign="bottom">  
                                <div style="text-align:right;">
                                   
                                    <span class="Link_blue1">
                                        <a href="javascript:void(0)" id="id_header_search" class="floatL">{% trans "查询" %}</a>
                                    </span>&nbsp;&nbsp
                                    <span class="Link_blue1">
                                        <a href="javascript:void(0)" id="id_header_clear" class="floatL">{% trans "清除" %}</a>
                                    </span>
                                    <div class="clear"></div>
                                </div>
                       </td>
                    </tr>
                    </table>
                </div>
				<!-- search_form end -->
				 {% endif %}
				 
			<!-- grid start -->
           <div  id="id_main_div" style="margin-top:10px;margin-left:10px;margin-right:10px;">
				<table class="m_grid" style="display: none"></table>
           </div>
		   <!-- grid end -->
{% endblock %}
</body>
<script type="text/javascript" src="{{ MEDIA_URL }}/jslib/flexigrid.pack.js"></script>
<script>

        {% autoescape off %}
			var hide_index = [];
			var cur_param = "";
			var cur_query = "";
			var $m_search = $("#id_search");
			$("#id_header_search").click(function(){
				var m_params = []
				$m_search.find("input,select").each(function(){
					m_params.push({name: $(this).attr("name"),value: $(this).val()});
				})
				$(".m_grid").flexOptions({
					newp :1,
					params : m_params
				}).flexReload();
				$(this).click()
			});	
		    function do_export(com,grid)
			{
				window.open("/grid/{{app_label}}/{{model_name}}/?export&reportname={{verbose_name}}&format=xls&hide="+hide_index.join(',')+'&'+cur_param)
			}
			
			function do_Submit(){
				var p =this;
				if (cur_query!="")
				{
					p.query = cur_query;
				}
				cur_param = 'page='+p.newp+'&rp='+p.rp+'&sortname='+p.sortname+'&sortorder='+p.sortorder+'&query='+p.query+'&qtype='+p.qtype
				return true;
			}
			
			function do_ToggleCol(cid, visible)
			{
				if (visible)
				{
					var _tmp = [];
					for (var i=0;i<hide_index.length;i++)
					{
						if (hide_index[i]!=cid){_tmp.push(hide_index[i]);}
					}
					hide_index = _tmp
				}
				else
				{
					hide_index.push(cid);
				}
			}
			m_obj = $(".m_grid").flexigrid({{grid_option}});

			$("#id_header_clear").click(function(){
					$m_search.find("input,select").each(function(){
							 switch($(this).attr("type"))
							 {
									 case 'text','textarea':
											 $(this).attr("value","");
											 break;
									 case 'checkbox','radio':
											 $(this).attr("checked",false);
											 break;                                 
									 default:
											 $(this).attr("value","");
											 break;
							 };
					 });
		             $div.find("#id_header_search").click();
			 });
        {% endautoescape %}
</script>
	{% block custom_js %}
	
	{% endblock %}  
</html>